package com.yukino.pojo.serviceResult;

import com.yukino.pojo.User;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class LoginUser implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 登录成功
     */
    public static final int LOGIN_SUCCESS = 0;

    /**
     * 用户名不存在
     */
    public static final int NO_EXIT = 1;

    /**
     * 密码错误
     */
    public static final int PASS_ERROR = 2;


    /**
     * 登录状态
     */
    private int code;

    /**
     * 用户信息
     */
    private User user;

    public LoginUser(int code) {
        this.code = code;
    }

    public static LoginUser getSuccess(User user) {
        return new LoginUser(LOGIN_SUCCESS,user);
    }

    public static LoginUser getNoExit() {
        return new LoginUser(NO_EXIT);
    }

    public static LoginUser getError() {
        return new LoginUser(PASS_ERROR);
    }
}
